//
//  SNAccountTool.m
//  顺农有机
//
//  Created by 冯贺 on 2018/1/12.
//  Copyright © 2018年 冯贺. All rights reserved.
//

#import "SNAccountTool.h"

@implementation SNAccountTool

+ (void)saveUserInfo:(NSDictionary *)dic{
    NSUserDefaults * df =[NSUserDefaults standardUserDefaults];
    [df setObject:dic forKey:@"userInfo"];
    [df synchronize];
}
+ (NSDictionary *)getUserInfoDic{
    NSUserDefaults * df =[NSUserDefaults standardUserDefaults];
    return [df objectForKey:@"userInfo"];
}
+ (SNUserInfoModel *)getUserInfo{
    NSUserDefaults * df =[NSUserDefaults standardUserDefaults];
    NSDictionary * content = [df objectForKey:@"userInfo"];
    return [SNUserInfoModel mj_objectWithKeyValues:content];
}
+ (void)removeUserInfo{
    [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"userInfo"];
}







//+ (BOOL)judgeLoginStatus:(UIViewController *)controller success:(void (^)(void))success{
//    SNUserInfoModel * model = [SNAccountTool getUserInfo];
//
//    if (!model.userId || !model.mobilePhone) {
//        SNLoginViewController * lvc =[SNLoginViewController new];
//        lvc.loginSuccess =^(){
//            success();
//        };
//        SMBaseNavigationController * nvc =[[SMBaseNavigationController alloc]initWithRootViewController:lvc];
//        [controller presentViewController:nvc animated:YES completion:nil];
//        
//        return NO;
//    }
//    return YES;
//}

+(void)saveisOnLine:(NSString *)content{
    NSUserDefaults * df =[NSUserDefaults standardUserDefaults];
    [df setObject:content forKey:@"isOnline"];
    [df synchronize];
}
+(NSString *)getisOnLine{
    NSUserDefaults * df =[NSUserDefaults standardUserDefaults];
    NSString * content = [df objectForKey:@"isOnline"];
    return content;
}

@end
